<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function setcookie(name,value,options){
            options=options||{}
            if(typeof options.expires=="number"){
                var d=new Date()
                d.setDate(d.getDate()+options.expires)
            }
            return document.cookie=[
                name+"="+value,
                typeof options.expires==="number"?";expires="+d:"",
                typeof options.path==="string"?";path="+options.path:"",
                typeof options.domain==="string"?";domain"+options.domain:"",
            ].join("")
        }
        setcookie("好好","哒哒",{
            path:"lll"
        })
        function setCookie(name,value,option){
            //判断option是否存在
            var option=option||{}
            if(typeof option.expires=="number"){
                var d=new Date()
                d.setDate(d.getDate()+option.expires)
            }
            return document.cookie=[
                typeof option.expires=="number"?";expries="+d:"",
                typeof option.path=="string"?";path="+option.path:"",
                typeof option.domain=="string"?";domain="+option.domain:"",
            ].join("")
        }
    </script>
</body>
</html>